package com.xi.jetcomposedemo.ui.compose

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.imageResource
import androidx.compose.ui.unit.dp
import com.xi.jetcomposedemo.R
import com.xi.jetcomposedemo.ui.theme.Green200
import com.xi.jetcomposedemo.ui.theme.Orange
import com.xi.jetcomposedemo.ui.theme.Teal200

@Composable
fun Avatar(modifier: Modifier = Modifier) {
    Image(
        modifier = modifier
            .size(50.dp)
            .clip(CircleShape)
            .border(
                shape = CircleShape,
                border = BorderStroke(
                    width = 2.dp,
                    brush = Brush.linearGradient(
                        colors = listOf(Color.Blue, Teal200, Green200, Orange),
                        start = Offset( 0f, 0f),
                        end = Offset(100f,100f)
                    )
                )
            )
            .border(
                shape = CircleShape,
                border = BorderStroke(4.dp, SolidColor(Color.Red))
            ),
        bitmap = ImageBitmap.imageResource(id = R.mipmap.miku),
        contentDescription = null, // decorative
    )
}